home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / rocnrope.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  13KB  |  356 lines

  1. /***************************************************************************
  2.  
  3. Based on drivers from Juno First emulator by Chris Hardy (chrish@kcbbs.gen.nz)
  4.  
  5. ***************************************************************************/
  6.  
  7. #include "driver.h"
  8. #include "vidhrdw/generic.h"
  9. #include "cpu/m6809/m6809.h"
  10.  
  11.  
  12. void konami1_decode(void);
  13.  
  14. WRITE_HANDLER( rocnrope_flipscreen_w );
  15. void rocnrope_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  16. void rocnrope_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  17.  
  18. /* defined in sndhrdw/timeplt.c */
  19. extern struct MemoryReadAddress timeplt_sound_readmem[];
  20. extern struct MemoryWriteAddress timeplt_sound_writemem[];
  21. extern struct AY8910interface timeplt_ay8910_interface;
  22. WRITE_HANDLER( timeplt_sh_irqtrigger_w );
  23.  
  24.  
  25. /* Roc'n'Rope has the IRQ vectors in RAM. The rom contains $FFFF at this address! */
  26. WRITE_HANDLER( rocnrope_interrupt_vector_w )
  27. {
  28.     unsigned char *RAM = memory_region(REGION_CPU1);
  29.  
  30.  
  31.     RAM[0xFFF2+offset] = data;
  32. }
  33.  
  34.  
  35. static struct MemoryReadAddress readmem[] =
  36. {
  37.     { 0x3080, 0x3080, input_port_0_r }, /* IO Coin */
  38.     { 0x3081, 0x3081, input_port_1_r }, /* P1 IO */
  39.     { 0x3082, 0x3082, input_port_2_r }, /* P2 IO */
  40.     { 0x3083, 0x3083, input_port_3_r }, /* DSW 0 */
  41.     { 0x3000, 0x3000, input_port_4_r }, /* DSW 1 */
  42.     { 0x3100, 0x3100, input_port_5_r }, /* DSW 2 */
  43.     { 0x4000, 0x5fff, MRA_RAM },
  44.     { 0x6000, 0xffff, MRA_ROM },
  45.     { -1 }  /* end of table */
  46. };
  47.  
  48. static struct MemoryWriteAddress writemem[] =
  49. {
  50.     { 0x4000, 0x403f, MWA_RAM, &spriteram_2 },
  51.     { 0x4040, 0x43ff, MWA_RAM },
  52.     { 0x4400, 0x443f, MWA_RAM, &spriteram, &spriteram_size },
  53.     { 0x4440, 0x47ff, MWA_RAM },
  54.     { 0x4800, 0x4bff, colorram_w, &colorram },
  55.     { 0x4c00, 0x4fff, videoram_w, &videoram, &videoram_size },
  56.     { 0x5000, 0x5fff, MWA_RAM },
  57.     { 0x8000, 0x8000, watchdog_reset_w },
  58.     { 0x8080, 0x8080, rocnrope_flipscreen_w },
  59.     { 0x8081, 0x8081, timeplt_sh_irqtrigger_w },  /* cause interrupt on audio CPU */
  60.     { 0x8082, 0x8082, MWA_NOP },    /* interrupt acknowledge??? */
  61.     { 0x8083, 0x8083, MWA_NOP },    /* Coin counter 1 */
  62.     { 0x8084, 0x8084, MWA_NOP },    /* Coin counter 2 */
  63.     { 0x8087, 0x8087, interrupt_enable_w },
  64.     { 0x8100, 0x8100, soundlatch_w },
  65.     { 0x8182, 0x818d, rocnrope_interrupt_vector_w },
  66.     { 0x6000, 0xffff, MWA_ROM },
  67.     { -1 }  /* end of table */
  68. };
  69.  
  70.  
  71. INPUT_PORTS_START( rocnrope )
  72.     PORT_START      /* IN0 */
  73.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  74.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  75.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  76.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  77.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  78.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  79.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  80.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  81.  
  82.     PORT_START      /* IN1 */
  83.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  84.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  85.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
  86.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  87.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  88.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  89.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  90.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  91.  
  92.     PORT_START      /* IN2 */
  93.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  94.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  95.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  96.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  97.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  98.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  99.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  100.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  101.  
  102.     PORT_START      /* DSW0 */
  103.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  104.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  105.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  106.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  107.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  108.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  109.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  110.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  111.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  112.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  113.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  114.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  115.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  116.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  117.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  118.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  119.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  120.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  121.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  122.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  123.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  124.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  125.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  126.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  127.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  128.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  129.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  130.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  131.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  132.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  133.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  134.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  135.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  136.     PORT_DIPSETTING(    0x00, "Disabled" )
  137. /* 0x00 disables Coin 2. It still accepts coins and makes the sound, but
  138.    it doesn't give you any credit */
  139.  
  140.     PORT_START      /* DSW1 */
  141.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  142.     PORT_DIPSETTING(    0x03, "3" )
  143.     PORT_DIPSETTING(    0x02, "4" )
  144.     PORT_DIPSETTING(    0x01, "5" )
  145.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
  146.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  147.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  148.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  149.     PORT_DIPNAME( 0x78, 0x78, DEF_STR( Difficulty ) )
  150.     PORT_DIPSETTING(    0x78, "Easy 1" )
  151.     PORT_DIPSETTING(    0x70, "Easy 2" )
  152.     PORT_DIPSETTING(    0x68, "Easy 3" )
  153.     PORT_DIPSETTING(    0x60, "Easy 4" )
  154.     PORT_DIPSETTING(    0x58, "Normal 1" )
  155.     PORT_DIPSETTING(    0x50, "Normal 2" )
  156.     PORT_DIPSETTING(    0x48, "Normal 3" )
  157.     PORT_DIPSETTING(    0x40, "Normal 4" )
  158.     PORT_DIPSETTING(    0x38, "Normal 5" )
  159.     PORT_DIPSETTING(    0x30, "Normal 6" )
  160.     PORT_DIPSETTING(    0x28, "Normal 7" )
  161.     PORT_DIPSETTING(    0x20, "Normal 8" )
  162.     PORT_DIPSETTING(    0x18, "Difficult 1" )
  163.     PORT_DIPSETTING(    0x10, "Difficult 2" )
  164.     PORT_DIPSETTING(    0x08, "Difficult 3" )
  165.     PORT_DIPSETTING(    0x00, "Difficult 4" )
  166.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  167.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  168.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  169.  
  170.     PORT_START      /* DSW2 */
  171.     PORT_DIPNAME( 0x07, 0x07, "First Bonus" )
  172.     PORT_DIPSETTING(    0x07, "20000" )
  173.     PORT_DIPSETTING(    0x05, "30000" )
  174.     PORT_DIPSETTING(    0x04, "40000" )
  175.     PORT_DIPSETTING(    0x03, "50000" )
  176.     PORT_DIPSETTING(    0x02, "60000" )
  177.     PORT_DIPSETTING(    0x01, "70000" )
  178.     PORT_DIPSETTING(    0x00, "80000" )
  179.     /* 0x06 gives 20000 */
  180.     PORT_DIPNAME( 0x38, 0x38, "Repeated Bonus" )
  181.     PORT_DIPSETTING(    0x38, "40000" )
  182.     PORT_DIPSETTING(    0x18, "50000" )
  183.     PORT_DIPSETTING(    0x10, "60000" )
  184.     PORT_DIPSETTING(    0x08, "70000" )
  185.     PORT_DIPSETTING(    0x00, "80000" )
  186.     /* 0x20, 0x28 and 0x30 all gives 40000 */
  187.     PORT_DIPNAME( 0x40, 0x00, "Grant Repeated Bonus" )
  188.     PORT_DIPSETTING(    0x40, DEF_STR( No ) )
  189.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  190.     PORT_DIPNAME( 0x80, 0x00, "Unknown DSW 8" )
  191.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  192.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  193. INPUT_PORTS_END
  194.  
  195.  
  196.  
  197. static struct GfxLayout charlayout =
  198. {
  199.     8,8,    /* 8*8 sprites */
  200.     512,    /* 512 characters */
  201.     4,    /* 4 bits per pixel */
  202.     { 0x2000*8+4, 0x2000*8+0, 4, 0 },
  203.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
  204.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  205.     16*8    /* every sprite takes 64 consecutive bytes */
  206. };
  207.  
  208. static struct GfxLayout spritelayout =
  209. {
  210.     16,16,    /* 16*16 sprites */
  211.     256,    /* 256 sprites */
  212.     4,    /* 4 bits per pixel */
  213.     { 256*64*8+4, 256*64*8+0, 4, 0 },
  214.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
  215.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
  216.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  217.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  218.     64*8    /* every sprite takes 64 consecutive bytes */
  219. };
  220.  
  221. static struct GfxDecodeInfo gfxdecodeinfo[] =
  222. {
  223.     { REGION_GFX1, 0, &charlayout,       0, 16 },
  224.     { REGION_GFX2, 0, &spritelayout, 16*16, 16 },
  225.     { -1 } /* end of array */
  226. };
  227.  
  228.  
  229.  
  230. static struct MachineDriver machine_driver_rocnrope =
  231. {
  232.     /* basic machine hardware */
  233.     {
  234.         {
  235.             CPU_M6809,
  236.             2048000,        /* 2 Mhz */
  237.             readmem,writemem,0,0,
  238.             interrupt,1
  239.         },
  240.         {
  241.             CPU_Z80 | CPU_AUDIO_CPU,
  242.             14318180/8,    /* 1.789772727 MHz */                        \
  243.             timeplt_sound_readmem,timeplt_sound_writemem,0,0,
  244.             ignore_interrupt,1    /* interrupts are triggered by the main CPU */
  245.         }
  246.     },
  247.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  248.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  249.     0,
  250.  
  251.     /* video hardware */
  252.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  253.     gfxdecodeinfo,
  254.     32,16*16+16*16,
  255.     rocnrope_vh_convert_color_prom,
  256.  
  257.     VIDEO_TYPE_RASTER,
  258.     0,
  259.     generic_vh_start,
  260.     generic_vh_stop,
  261.     rocnrope_vh_screenrefresh,
  262.  
  263.     /* sound hardware */
  264.     0,0,0,0,
  265.     {
  266.         {
  267.             SOUND_AY8910,
  268.             &timeplt_ay8910_interface
  269.         }
  270.     }
  271. };
  272.  
  273. /***************************************************************************
  274.  
  275.   Game driver(s)
  276.  
  277. ***************************************************************************/
  278.  
  279. ROM_START( rocnrope )
  280.     ROM_REGION( 2*0x10000, REGION_CPU1 )     /* 64k for code + 64k for decrypted opcodes */
  281.     ROM_LOAD( "rr1.1h",       0x6000, 0x2000, 0x83093134 )
  282.     ROM_LOAD( "rr2.2h",       0x8000, 0x2000, 0x75af8697 )
  283.     ROM_LOAD( "rr3.3h",       0xa000, 0x2000, 0xb21372b1 )
  284.     ROM_LOAD( "rr4.4h",       0xc000, 0x2000, 0x7acb2a05 )
  285.     ROM_LOAD( "rnr_h5.vid",   0xe000, 0x2000, 0x150a6264 )
  286.  
  287.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  288.     ROM_LOAD( "rnr_7a.snd",   0x0000, 0x1000, 0x75d2c4e2 )
  289.     ROM_LOAD( "rnr_8a.snd",   0x1000, 0x1000, 0xca4325ae )
  290.  
  291.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  292.     ROM_LOAD( "rnr_h12.vid",  0x0000, 0x2000, 0xe2114539 )
  293.     ROM_LOAD( "rnr_h11.vid",  0x2000, 0x2000, 0x169a8f3f )
  294.  
  295.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  296.     ROM_LOAD( "rnr_a11.vid",  0x0000, 0x2000, 0xafdaba5e )
  297.     ROM_LOAD( "rnr_a12.vid",  0x2000, 0x2000, 0x054cafeb )
  298.     ROM_LOAD( "rnr_a9.vid",   0x4000, 0x2000, 0x9d2166b2 )
  299.     ROM_LOAD( "rnr_a10.vid",  0x6000, 0x2000, 0xaff6e22f )
  300.  
  301.     ROM_REGION( 0x0220, REGION_PROMS )
  302.     ROM_LOAD( "a17_prom.bin", 0x0000, 0x0020, 0x22ad2c3e )
  303.     ROM_LOAD( "b16_prom.bin", 0x0020, 0x0100, 0x750a9677 )
  304.     ROM_LOAD( "rocnrope.pr3", 0x0120, 0x0100, 0xb5c75a27 )
  305. ROM_END
  306.  
  307. ROM_START( rocnropk )
  308.     ROM_REGION( 2*0x10000, REGION_CPU1 )     /* 64k for code + 64k for decrypted opcodes */
  309.     ROM_LOAD( "rnr_h1.vid",   0x6000, 0x2000, 0x0fddc1f6 )
  310.     ROM_LOAD( "rnr_h2.vid",   0x8000, 0x2000, 0xce9db49a )
  311.     ROM_LOAD( "rnr_h3.vid",   0xa000, 0x2000, 0x6d278459 )
  312.     ROM_LOAD( "rnr_h4.vid",   0xc000, 0x2000, 0x9b2e5f2a )
  313.     ROM_LOAD( "rnr_h5.vid",   0xe000, 0x2000, 0x150a6264 )
  314.  
  315.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  316.     ROM_LOAD( "rnr_7a.snd",   0x0000, 0x1000, 0x75d2c4e2 )
  317.     ROM_LOAD( "rnr_8a.snd",   0x1000, 0x1000, 0xca4325ae )
  318.  
  319.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  320.     ROM_LOAD( "rnr_h12.vid",  0x0000, 0x2000, 0xe2114539 )
  321.     ROM_LOAD( "rnr_h11.vid",  0x2000, 0x2000, 0x169a8f3f )
  322.  
  323.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  324.     ROM_LOAD( "rnr_a11.vid",  0x0000, 0x2000, 0xafdaba5e )
  325.     ROM_LOAD( "rnr_a12.vid",  0x2000, 0x2000, 0x054cafeb )
  326.     ROM_LOAD( "rnr_a9.vid",   0x4000, 0x2000, 0x9d2166b2 )
  327.     ROM_LOAD( "rnr_a10.vid",  0x6000, 0x2000, 0xaff6e22f )
  328.  
  329.     ROM_REGION( 0x0220, REGION_PROMS )
  330.     ROM_LOAD( "a17_prom.bin", 0x0000, 0x0020, 0x22ad2c3e )
  331.     ROM_LOAD( "b16_prom.bin", 0x0020, 0x0100, 0x750a9677 )
  332.     ROM_LOAD( "rocnrope.pr3", 0x0120, 0x0100, 0xb5c75a27 )
  333. ROM_END
  334.  
  335.  
  336.  
  337. static void init_rocnrope(void)
  338. {
  339.     unsigned char *rom = memory_region(REGION_CPU1);
  340.     int diff = memory_region_length(REGION_CPU1) / 2;
  341.  
  342.  
  343.     konami1_decode();
  344.     rom[0x703d + diff] = 0x98;    /* fix one instruction */
  345. }
  346.  
  347. static void init_rocnropk(void)
  348. {
  349.     konami1_decode();
  350. }
  351.  
  352.  
  353.  
  354. GAME( 1983, rocnrope, 0,        rocnrope, rocnrope, rocnrope, ROT270, "Konami", "Roc'n Rope" )
  355. GAME( 1983, rocnropk, rocnrope, rocnrope, rocnrope, rocnropk, ROT270, "Konami + Kosuka", "Roc'n Rope (Kosuka)" )
  356.